package com.huifer.wgx.utlis;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

/**
 * <p>Title : ListUtil </p>
 * <p>Description : ListUtil</p>
 *
 * @author huifer
 * @date 2019-03-20
 */
public class ListUtil {

    public static List<HashMap<String, String>> strList2ListMap(List<List<String>> lists) {
        List<HashMap<String, String>> res = new ArrayList<>();
        List<String> strings = lists.get(0);
        return res = IntStream.range(1, lists.size()).mapToObj(lists::get)
                .map(strings1 -> IntStream.range(0, strings1.size()).boxed().collect(
                        Collectors.toMap(strings::get, strings1::get, (a, b) -> b,
                                () -> new HashMap<>(strings1.size()))))
                .collect(Collectors.toList());
    }

}

